package com.alex.ip.holder.server.properties;

import cn.hutool.http.Method;
import java.io.Serializable;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author Alex.Liu
 * @date: 2025-02-18 16:53
 * @since 1.0.0
 */
@Getter
@Setter
@Component
@ConfigurationProperties(prefix = "alex-ip-holder")
public class HolderProperties {

    /**
     * 客戶端配置
     */
    private Client client;

    /**
     * 客戶端配置
     */
    @Getter
    @Setter
    public static final class Client implements Serializable {

        /**
         * 是否開啟簡況檢查
         */
        private boolean checkEnabled = Boolean.TRUE;

        /**
         * 檢查接口允許請求方式
         */
        private Method checkMethod = Method.GET;

        /**
         * 健康檢測超時時間 MS
         */
        private int checkTimeout = 120000;

        /**
         * 健康檢查地址
         */
        private String checkUri = "/check";

        /**
         * 簡況檢查狀態為SUCCESS 時認為服務沒有問題
         */
        private String successResult = "SUCCESS";

    }
}
